﻿/**
 * @brief 区分并读取".vtk"格式的数据
 * 目前可区分读取 vtkPolyData/vtkUnstructedGrid类型
*/
#ifndef QVTK_MUTIVTKFILESREADER_H
#define QVTK_MUTIVTKFILESREADER_H
#include <QString>

class vtkPolyDataReader;
class vtkPointSet;
class vtkUnstructuredGridReader;
class vtkStructuredGridReader;

namespace pst
{
    class MutiVTKFilesReader
    {
        enum DataType
        {
            POLYDATA,
            UNSTRUCTEDGRID,
            STRUCTEDGRID,
            UNKNOWN //包括 文件不存在 和 不支持的.vtk格式 两种类型
        };

    public:
        MutiVTKFilesReader();
        ~MutiVTKFilesReader();

    public:
        void SetFileName(const QString& fileName);
        bool Update(QString& errorMess);
        vtkPointSet* GetOutput();
        //获取文件的内部类型，如vtkPolyData、vtkUnstructedGrid
        QString GetFileInnerTypeAsStrng();

    private:
        DataType CheckDataInnerType();

    private:
        QString m_fileName;
        vtkPolyDataReader* m_polyDataReader;
        vtkUnstructuredGridReader* m_unstructuredGridReader;
        vtkStructuredGridReader* m_structuredGridReader;
        QString m_fileType;
        vtkPointSet* m_outputData;
    };

} //namespace pst
#endif // QVTK_MUTIVTKFILESREADER_H
